// 步数
import {visibleChartLabel} from "/@/utils/utils.ts";

export function screenPie(chartData) {
    const data = visibleChartLabel(chartData)
    return {
        color: ['#B750BE', '#6C63F0', '#3AACFF', '#ED589D', '#FB466C'],
        tooltip: {
            trigger: 'item',
            show: true,
            textStyle: {
                color: '#fff',
            },
            backgroundColor: 'rgba(50,50,50,0.7)',
            borderColor: '#1b7ef2',
        },
        legend: {
            right: '5%',
            top: 'center',
            orient: 'vertical',
            icon: 'circle',
            itemGap: 8,
            textStyle: {
                color: '#ffffff',
                fontSize: 16,
            },
            selectedMode: false
        },
        series: [
            {
                type: 'pie',
                radius: ['50%', '72%'],
                center: ['37%', '49%'],
                avoidLabelOverlap: false,
                label: {
                    show: true,
                    position: 'outside',
                    color: '#ffffff',
                    fontSize: 14,
                },
                labelLine: {
                    show: true,
                    length: 6,
                    length2: 10,
                    minTurnAngle: 120,
                },
                data: data,
            },
        ],
    };
}

//左侧圆
export function circleRing(chartData, total, color) {
    const data = visibleChartLabel(chartData)
    return {
        color: color,
        tooltip: {
            trigger: 'item',
            show: true,
            textStyle: {
                color: '#fff',
            },
            backgroundColor: 'rgba(50,50,50,0.7)',
            borderColor: '#1b7ef2',
        },
        legend: {
            left: '74%',
            top: 'center',
            orient: 'vertical',
            icon: 'circle',
            itemGap: 16,
            textStyle: {
                color: '#ffffff',
                fontSize: 16,
            },
            selectedMode: false
        },
        series: [
            {
                type: 'pie',
                radius: ['50%', '75%'],
                center: ['42%', '50%'],
                avoidLabelOverlap: false,
                // label: {
                //     show: true,
                //     // position: 'inner',
                //     formatter: '{d}%',
                //     color: '#ffffff',
                //     fontSize: 14,
                // },
                // labelLine: {
                //     show: false,
                // },
                label: {
                    show: true,
                    position: 'outside',
                    formatter: '{d}%',
                    color: '#ffffff',
                    fontSize: 14,
                },
                labelLine: {
                    show: true,
                    length: 4,
                    length2: 12,
                    minTurnAngle: 120,
                },
                data: data,
            },
        ],
    };
}